
package com.community.itelligentcommunity.community.myCommunity.service;

import com.community.itelligentcommunity.common.base.dao.GenericDao;
import com.community.itelligentcommunity.common.base.service.GenericService;
import com.community.itelligentcommunity.common.util.user.UserInfo;
import com.community.itelligentcommunity.community.myCommunity.dao.GoodOderDao;
import com.community.itelligentcommunity.community.myCommunity.entity.GoodOder;
import com.community.itelligentcommunity.community.myCommunity.entity.QueryGoodOder;
import com.community.itelligentcommunity.sys.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = {IllegalArgumentException.class})
public class GoodOderService extends GenericService<GoodOder, QueryGoodOder> {

    @Autowired
    private GoodOderDao goodOderDao;

    @Override
    protected GenericDao<GoodOder, QueryGoodOder> getDao() {
        return goodOderDao;
    }

    @Override
    public boolean save(GoodOder entity) throws Exception {
        User uf= UserInfo.getUser();
        entity.setOrderCustomer(uf.getNickName());
        entity.setCustomerId(uf.getId());
        return super.save(entity);
    }
}
